home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import gtk
- import gobject
- import sys
- import dbus
- import logging
- import ScreenResolution
- SERVICE_NAME = 'com.ubuntu.ScreenResolution.Mechanism'
- OBJECT_PATH = '/'
- INTERFACE_NAME = 'com.ubuntu.ScreenResolution.Mechanism'
- usage = 'python policy-dontzap.py --enable'
- import os
- import sys
-
- def get_dontzap_service(widget = None):
- '''
- returns a dbus interface to the screenresolution mechanism
- '''
- service_object = dbus.SystemBus().get_object(SERVICE_NAME, OBJECT_PATH)
- service = dbus.Interface(service_object, INTERFACE_NAME)
- return service
-
-
- def main(enable):
- if enable not in ('--enable', '--disable'):
- logging.error('called with wrong arguments = %s' % str(enable))
- return False
- conf = get_dontzap_service()
- if not conf:
- logging.error('cannot connect to dbus service')
- sys.exit(1)
-
- logging.debug('setting dontzap to %s' % enable)
- exit_code = conf.setDontZap(enable)
- logging.debug('exit status: %d' % exit_code)
- return exit_code
-
- if __name__ == '__main__':
- if len(sys.argv) > 1:
- operation_status = main(sys.argv[1])
- else:
- operation_status = 1
- sys.exit(operation_status)
-
-